<template>
	<view class="container">
		<!-- <jc-navbar title="财务管理" @back="back"></jc-navbar> -->
		<!-- 通知栏 -->
		<!-- <view class="noticeView">
			<u-notice-bar mode='horizontal' speed='100' :list="noticeList"></u-notice-bar>
		</view> -->
		<view class="top" style="padding-top: 30rpx;">
			<!-- <view class="headView">
				<view class="otherBalance">
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomes||0}}</text>
						<text class="title">可用资产</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.moneyForProperaty||0}}</text>
						<text class="title">锁定资产</text>
					</view>
				</view>
			</view> -->
		</view>
		
		<view class="main">
			<!-- 头部视图 -->
			<view class="headView">
				<view class="otherBalance" style="flex-wrap: wrap;justify-content: flex-start">
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomesLocked||0}}</text>
						<text class="title">待补贴资产</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomes||0}}</text>
						<text class="title">购物积分</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.outMoneying||0}}</text>
						<text class="title">提现中</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.contributionValue||0}}</text>
						<text class="title">贡献值</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomesCredit||0}}</text>
						<text class="title">抵扣积分</text>
					</view>
					<view class="item">
						<text class="timeLenght">{{walletInfo.incomesOriginal||0}}</text>
						<text class="title">原积分</text>
					</view>
				</view>
			</view>
			<view class="itemCate" style="background-color: #FFF;" v-if="0">
				<view class="item" @click="sendIncomesTap({'scene': 'sendBalance', 'title': '流动资产转增'})">
					<u-icon name="gift" size='36' color='#f0ad4e'></u-icon>
					<text style="margin-top: 30rpx;color: #666666;">流动资产转增</text>
				</view>
				<view class="item" @click="sendIncomesTap({'scene': 'sendIncomes', 'title': '信贝转赠'})">
					<u-icon name="gift" size='36' color='#dd524d'></u-icon>
					<text style="margin-top: 30rpx;color: #666666;">信贝转增</text>
				</view>
				<view class="item" @click="toIncomesTap">
					<u-image src='/static/mine/update.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">兑换金信贝</text>
				</view>
				<view class="item" @click="gupiaoZrTap">
					<u-icon name="hourglass" size='36' color='#dd524d'></u-icon>
					<!-- <u-image src='/static/mine/update.png' width='60rpx' height='60rpx'></u-image> -->
					<text style="margin-top: 30rpx;color: #666666;">股票申请转让</text>
				</view>
			</view>
			<view class="itemCate" style="background-color: #FFF;">
				<view class="item" @click="goRecordIncomesLocked({'title': '锁定积分记录'})">
					<u-image src='/static/mine/incomesList.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">补贴资产流水</text>
				</view>
				<view class="item" @click="incomesListTap({'payway': 'incomes', 'title': '购物积分流水'})">
					<u-image src='/static/mine/dept.png' width='60rpx' height='60rpx'></u-image>
					<text style="margin-top: 30rpx;color: #666666;">购物积分流水</text>
				</view>
				<view class="item" @click="incomesListTap({'payway': 'contributionValue', 'title': '贡献值流水'})">
					<u-icon name="file-text" size='36' color='#f0ad4e'></u-icon>
					<text style="margin-top: 30rpx;color: #666666;">贡献值流水</text>
				</view>
				<view class="item" @click="incomesListTap({'payway': 'incomesCredit', 'title': '抵扣积分流水'})">
					<u-icon name="file-text" size='36' color='#dd524d'></u-icon>
					<text style="margin-top: 30rpx;color: #666666;">抵扣积分流水</text>
				</view>
				<view class="item" @click="incomesListTap({'payway': 'incomesOriginal', 'title': '原积分流水'})">
					<u-icon name="hourglass" size='36' color='#00d800'></u-icon>
					<text style="margin-top: 30rpx;color: #666666;">原积分流水</text>
				</view>
			</view>
			
			<!-- 充值提现按钮 -->
			<view class="CZTX" :style="{paddingBottom: safeAreaBottom + 'px'}">
				<view style="background-color: #FC5E53;color: #FFF;"
				class="default" @click="inMoneyAction">充值</view>
				<view style="background-color: #FFF;color: #FC5E53;"
				class="default" @click="outMoneyAction">提现</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {wallet} from '@/api/wallet.js'
	import jcButton from "@/components/jc-button/jc-button.vue"
	export default {
		components:{jcButton},
		data() {
			return {
				page: 1,
				size: 8,
				totalPage: 0,
				walletInfo: {},
				itemList: [],
				noticeList:['通知：近期提现人数较多，到账时间会可能延迟，敬请谅解！'],
				value1: 1,
				value2: 2,
				currentIncomeCate: '',
				safeAreaBottom: 0
			}
		},
		onLoad() {
			this.safeAreaBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
		},
		onShow() {
			this.myWallet()
		},
		onPullDownRefresh() {
			this.myWallet()
		},
		methods: {
			back(){
				uni.switchTab({
					url: '/pages/mine/mine'
				})
			},
			outMoneyAction(){
				this.$Router.push({
					name: 'outMoney'
				})
			},
			inMoneyAction(){
				this.$Router.push({
					name: 'inMoney'
				})
			},
			myWallet() {
				wallet.getWalletInfo().then(res => {
					uni.stopPullDownRefresh();
					if (res.data.code == 10000) {
						this.walletInfo = res.data.data
					}
				})
			},
			goRecordIncomesLocked(params){
				this.$Router.push({
					name: 'recordIncomesLocked',
					params: params
				})
			},
			//积分明细
			incomesListTap(params){
				this.$Router.push({
					name: 'incomeList',
					params: params
				})
			},
			//资产管理
			myPropertyTap(){
				this.$Router.push({
					name: 'myProperty'
				})
			},
			//提现记录
			outMoneyListTap(){
				this.$Router.push({
					name: 'incomeList',
					params: {
						scene: 'outMoneyList'
					}
				})
			},
			//积分赠送
			sendIncomesTap(params){
				this.$Router.push({
					name: 'sendIncomes',
					params: params
				})
			},
			//金币赠送
			toIncomesTap(){
				this.$Router.push({
					name: 'toIncomes',
				})
			},
			//股票转让
			gupiaoZrTap(){
				this.$Router.push({
					name: 'gupiaoZr',
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.noticeView{
		// position: fixed;
		// left: 0;
		// top: 0;
		z-index: 10;
	}
	.top{
		width: 750rpx;
		height: 120rpx;
		background-color: #FC5E53;
	}
	.main{
		position: relative;
		top: -80rpx;
	}
	.headView{
		display: flex;
		flex-direction: column;
		align-items: center;
		background-color: #FFFFFF;
		margin: 0 20rpx;
		padding-top: 30rpx;
		border-radius: 20rpx;
		box-shadow:0 8rpx 16rpx rgba(0, 0, 0, 0.08);
		.totalBalance{
			display: flex;
			flex-direction: column;
			align-items: center;
			.title{
				font-size: 30rpx;
				color: #999999;
			}
			.timeLenght{
				font-size: 50rpx;
				font-weight: bold;
			}
		}
		.otherBalance{
			width: 100%;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-around;
			.item{
				display: flex;
				flex-direction: column;
				align-items: center;
				margin-bottom: 30rpx;
				width: 33%;
				.title{
					margin-top: 8rpx;
					font-size: 30rpx;
					color: #999999;
				}
				.timeLenght{
					font-size: 34rpx;
					font-weight: bold;
				}
			}
		}
		
	}
	
	.itemCate{
		display: flex;
		flex-direction: row;
		margin-top: 20rpx;
		flex-wrap: wrap;
		.item{
			margin-left: 30rpx;
			width: 210rpx;
			height: 210rpx;
			background-color: #FFFFFF;
			border-radius: 16rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
		}
	}
	.CZTX{
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-around;
		margin-top: 20rpx;
		position: fixed;
		bottom: 0;
		background-color: #FFF;
		.default{
			width: 50%;
			text-align: center;
			height: 88rpx;
			line-height: 88rpx;
		}
	}
</style>
